<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div id="container">
  <input type="text" id="input" readonly>
  <textarea disabled id="textarea"></textarea>
  <fieldset disabled>
    <input id="range-in-fieldset" type="range" value="1" min="1" max="3">
    <p id="para-in-fieldset">paragraph</p>
  </fieldset>
</div>

<script>
function axElementById(id) {
    return accessibilityController.accessibleElementById(id);
}

test(function(t) {
    var ax = axElementById("input");
    assert_equals(ax.restriction, "readOnly");
}, "A readonly input is readonly");

test(function(t) {
    var ax = axElementById("textarea");
    assert_equals(ax.restriction, "disabled");
}, "A textarea can be disabled");

test(function(t) {
    var ax = axElementById("range-in-fieldset");
    assert_equals(ax.restriction, "disabled");
}, "A range in a disabled fieldset is disabled");

test(function(t) {
    var ax = axElementById("para-in-fieldset");
    assert_equals(ax.restriction, "none");
}, "A paragraph in a disabled fieldset is not disabled");

</script>
</body>
</html>
